<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable('teacher_lesson')) { return; }

        Schema::create('teacher_lesson', function (Blueprint $table) {
            $table->id()->unique();
            $table->integer('teacher_id')->comment('教师ID');
            $table->string('lesson_date')->comment('课程日期');
            $table->string('lesson_time_ids')->comment('课程时段id列表');
            $table->creatorId();
            $table->createdAt();
            $table->updatedAt();

            $table->engine='InnoDB';
            $table->comment('教师每日上课时段');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('teacherLesson');
    }
};
